home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group02b.txt / 000085_icon-group-sender_Wed Oct 23 13:00:51 2002.msg < prev    next >
Internet Message Format  |  2003-01-02  |  1KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id g9NJxew14318
  4.     for icon-group-addresses; Wed, 23 Oct 2002 12:59:40 -0700 (MST)
  5. Message-Id: <200210231959.g9NJxew14318@baskerville.CS.Arizona.EDU>
  6. From: "Paul W. Abrahams" <abrahams@acm.org>
  7. To: icon2002@OptOnLine.net
  8. Subject: move_corresponding
  9. Date: Wed, 23 Oct 2002 14:57:43 -0400
  10. Cc: icon-group@cs.arizona.edu
  11. Errors-To: icon-group-errors@cs.arizona.edu
  12. Status: RO
  13.  
  14. On Wednesday 23 October 2002 11:43 am, Steve Hunter wrote:
  15. > record r1(a,b,c,d)
  16. >
  17. > procedure main()
  18. > local x1
  19. > x1:=r1("one","two","three","four")
  20. > fld_nm := "a"; x1[fld_nm]:="pete"
  21. > write(name(x1.a),":",image(x1.a),":",x1.a)
  22. >
  23. > end
  24.  
  25. I hadn't realized that a record can be subscripted by a field name as well as 
  26. by a position (but of course it can).   I found a kludgy workaround for the 
  27. problem, by building tables that map field names to their positions, but this 
  28. solution is far better.
  29.  
  30. Paul
  31.